local Lua__tongkutwo = fk.CreateSkill {

  name = "Lua__tongkutwo",

}

Fk:loadTranslationTable{
    
    ["Lua__tongkutwo"] = "痛苦",
    ["$Lua__tongkutwo1"] = "让他们鲑鱼大帝！",
    [":Lua__tongkutwo"] = "当你成为伤害牌的目标或使用牌造成伤害后，你获得x枚“痛苦”标记（x为你的已损失体力值），然后若你的痛苦数大于你的体力上限，你移去所有痛苦并回复一点体力。",
    ["@tongku"] = "痛苦",
    
}

Lua__tongkutwo:addEffect(fk.TargetConfirmed, {
    anim_type = "control",
    can_trigger = function(self, event, target, player, data)
        if not player:hasSkill(Lua__tongkutwo.name) then return false end
        local lost_hp = player:getLostHp()
        return target == player and data.card and data.card.is_damage_card and lost_hp > 0
    end,
    on_cost = Util.TrueFunc,
    on_use = function(self, event, target, player, data)
        local room = player.room
        local lost_hp = player:getLostHp()
        -- 增加痛苦标记
        room:addPlayerMark(player, "@tongku", lost_hp)
        -- 检查是否超过体力上限
        if player:getMark("@tongku") > player.maxHp then
            room:setPlayerMark(player, "@tongku", 0)
            room:recover({
                who = player,
                num = 1,
                recoverBy = player,
                skillName = Lua__tongkutwo.name
            })
        end
    end,
})
Lua__tongkutwo:addEffect(fk.DamageCaused, {
    anim_type = "control",
    can_trigger = function(self, event, target, player, data)
        if not player:hasSkill(Lua__tongkutwo.name) then return false end
        local lost_hp = player:getLostHp()
        return target == player and data.card and lost_hp > 0
    end,
    on_cost = Util.TrueFunc,
    on_use = function(self, event, target, player, data)
        local room = player.room
        local lost_hp = player:getLostHp()
        -- 增加痛苦标记
        room:addPlayerMark(player, "@tongku", lost_hp)
        -- 检查是否超过体力上限
        if player:getMark("@tongku") > player.maxHp then
            room:setPlayerMark(player, "@tongku", 0)
            room:recover({
                who = player,
                num = 1,
                recoverBy = player,
                skillName = Lua__tongkutwo.name
            })
        end
    end,
})

return Lua__tongkutwo